package com.hnkywl.sts.dao.jhgl;

import com.hnkywl.sts.entity.jhgl.Cgwzjh;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.Criteria;
import org.hibernate.criterion.CriteriaSpecification;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Property;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Types;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: ZHUCHG
 * Date: 13-4-3
 * Time: 上午9:58
 * To change this template use File | Settings | File Templates.
 */
@Repository
public class CgwzjhDao extends WzjhDao<Cgwzjh> {
    public Map findXyByCgwzjh(Long id) {
        Criteria criteria = this.getSession().createCriteria(this.entityClass)
                .setProjection(Projections.projectionList()
                        .add(Property.forName("xy").as("xy"))
                )
                .add(Restrictions.eq("id", id))
                .setResultTransformer(CriteriaSpecification.ALIAS_TO_ENTITY_MAP);
        return (Map) criteria.uniqueResult();
    }
}
